<template>
    <div class="logistics">
        <div class="base_header">
            <img @click="goBack()" class="back" src="../../assets/img/back.png" alt="">物流详情
        </div>
        <div class="logistics_info">
            <p><span>物流状态</span>
                <span class="blue" v-show="logistics.state == '0'">在途</span>
                <span class="blue" v-show="logistics.state == '1'">揽件</span>
                <span class="blue" v-show="logistics.state == '2'">疑难</span>
                <span class="blue" v-show="logistics.state == '3'">签收</span>
                <span class="blue" v-show="logistics.state == '4'">退签</span>
            </p>
            <p>快递公司：{{logistics.expressName}}</p>
            <p>运单编号：{{logistics.nu}}</p>
        </div>
        <div style="background: #ffffff;padding-top: 15px">
            <ul class="vertical-list logistics_list">
                <li :class="{active:index == 0}"  v-for="(item,index) in logistics.data">
                    <p>{{item.context}}</p>
                    <p>{{item.ftime}}</p>
                </li>

            </ul>
        </div>
    </div>
</template>

<style>
    @import url("./logistics.css");
</style>
<script>
    import Layer from '../../assets/js/MessageBox'
    import API from '../../assets/js/API'
    import Validate from '../../assets/js/Validate'

    export default {
        data() {
            return {
                deliveryOrderCode: this.$route.query.deliveryOrderCode,
                logistics:{}
            }
        },
        created() {
             window.scrollTo(0,0);
            let url = API.serviceDomain + API.orderExpress + "/" + this.deliveryOrderCode;
            console.log(url);
            this.$http({method: "get", url: url, header: {token: localStorage.getItem('token')}}).then(
                (res) => {
                    if (res.body.status == '000000') {
                        console.log(res.body.data);
                       this.logistics = res.body.data;
                    } else {
                        Layer.showMsg(res.body.message);
                    }
                },
                (error) => {
                    Layer.showMsg("服务器开小差了...")
                    return
                }
            )
        },
        mounted() {
            this.imageDomain = API.imageDomain;
            let token = localStorage.getItem('token');
            if (!token) {
                Layer.showMsg("您还未登录!");
                this.$router.push({path: '/login'});
            }
        },
        methods: {
            goBack() {
                this.$router.goBack()
            }
        }

    }
</script>
